//
//  QJNearVCTCell.m
//  QuanJieShopProject
//
//  Created by apple on 2018/2/9.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "QJNearVCTCell.h"
//星级评价
#import "QJStartView.h"
@implementation QJNearVCTCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    
    // Initialization code
}
-(void)cellUpdateWithModel:(NearShopModel *)model{
    if (model) {
        QJStartView *startView = [[QJStartView alloc]initWithFrame:self.startView.bounds numberOfStars:5 rateStyle:HalfStar isAnination:YES delegate:self];
        startView.canChange = NO;
        [self.startView addSubview:startView];
        startView.currentScore = [model.star floatValue];
        
        [self.cellImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",NET_BASEURL,model.image_url_thumb]] placeholderImage:[UIImage imageNamed:@"noImage"]];
        self.cellTitleLabel.text = [NSString stringWithoutNilFormart:model.shop_name];
        self.cellNumberLabel.text = [NSString stringWithFormat:@"%@人消费",model.consume_amount];
        
        NSLog(@"distance = %@", model.distance);
        
        if ([model.distance isEqualToString:@""]) { // 异常数据不显示
            self.cellDistanceLabel.text = @"";
        }else {
            // 精确到米
            CGFloat dis = [model.distance floatValue];
            if (dis < 1000) {
                self.cellDistanceLabel.text = [NSString stringWithFormat:@"%.0fm", dis];
            }else {
                self.cellDistanceLabel.text = [NSString stringWithFormat:@"%.1fkm", dis/1000.0];
            }
        }
        
    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
